<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>Document</title>
  <style>
    html,
    body {
      margin: 0;
      padding: 0;
      background-color: lightpink;
    }

    .one {
      width: 200px;
      height: 100px;
      margin-top: 300px;
      margin-left: 200px;
      background-color: wheat;
    }
  </style>
</head>

<body>
  <div class="one"></div>
  <script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.js"></script>

  <script>
    var obj = {
      screenHeight: window.screen.height,
      screenWidth: window.screen.width,
      screenAvailWidth: window.screen.availHeight,

      screenLeft: window.screenLeft,
      screenTop: window.screenTop,

      appOuterWidth: window.outerWidth,
      appOuterHeight: window.outerHeight,
      appinnerWidth: window.innerWidth,
      appinnerHeight: window.innerHeight,

      appBodyClientWidth: document.body.clientWidth,
      appBodyClientHeight: document.body.clientHeight,

      ca: window.outerHeight - window.innerHeight,

      chromeToolHeight: window.outerHeight - window.innerHeight - 8,
      ieToolHeight:
        window.screenTop - (window.outerHeight - window.innerHeight - 30),
      chromeDocY:
        window.screenTop + (window.outerHeight - window.innerHeight - 8),

      IEDocY: window.screenTop
    };

    function get() {
      obj = {
        screenHeight: window.screen.height,
        screenWidth: window.screen.width,
        screenAvailWidth: window.screen.availHeight,

        screenLeft: window.screenLeft,
        screenTop: window.screenTop,

        appOuterWidth: window.outerWidth,
        appOuterHeight: window.outerHeight,

        appinnerWidth: window.innerWidth,
        appinnerHeight: window.innerHeight,

        appBodyClientWidth: document.body.clientWidth,
        appBodyClientHeight: document.body.clientHeight,

        ca: window.outerHeight - window.innerHeight,
        chromeToolHeight: window.outerHeight - window.innerHeight - 8,
        ieToolHeight:
          window.screenTop - (window.outerHeight - window.innerHeight - 30),
        chromeDocY:
          window.screenTop + (window.outerHeight - window.innerHeight - 8),
        IEDocY: window.screenTop
      };
    }

    var objDesc = {
      screenHeight: "屏幕高",
      screenWidth: "屏幕宽",
      screenAvailWidth: "屏幕可用高度,即去掉任务栏调试",

      screenLeft: "浏览器距屏幕左侧水平距离",
      screenTop: "浏览器距屏幕上侧竖直距离",

      appOuterWidth: "浏览器宽度",
      appOuterHeight: "浏览器高度",

      appinnerWidth: "",
      appinnerHeight: "不含工具栏的高度,但含滚动条",

      appBodyClientWidth:
        "浏览器可见宽度,不含滚动条,Body的展示宽度,可能body含margin,margin部分不算",
      appBodyClientHeight:
        "浏览器可见高度,不含滚动条,Body的展示高度,可能body含margin,margin部分不算",

      ca: "window.outerHeight - window.innerHeight",

      chromeToolHeight:
        "window.outerHeight - window.innerHeight - 8,全屏时不修正",
      ieToolHeight:
        "window.screenTop - (window.outerHeight - window.innerHeight - 30)",
      chromeDocY:
        "window.screenTop + (window.outerHeight - window.innerHeight - 8)",
      IEDocY: "window.screenTop"
    };

    for (x in obj) {
      console.log(obj[x], x + ":" + objDesc[x]);
    }

    jQuery(function () {
      console.log($(".one").offset().top, "offset.top");
      console.log($(".one").offset().left, "offset.left");

      jQuery(window).resize(function () {
        get();
        for (x in obj) {
          console.log(obj[x], x + ":" + objDesc[x]);
        }
      });
    });

    var Ts;

    TS = {
      window: window,

      ScreenWidth: window.screen.width,//屏幕宽
      ScreenHeight: window.screen.height,//屏幕高

      WindowLeft: window.screenLeft + 8,
      WindowTop: window.screenTop

    }

    var showDic = {
      window: '窗口本身对象',
      ScreenWidth: '屏幕宽',
      ScreenHeight: '屏幕高',

      WindowTop: "窗口距顶",
      WindowLeft: "窗口距左",
    }

    for (x in TS) {
      console.log(TS[x], x + ":" + showDic[x]);
    }

    //窗口左下角
    var pos = {
      x: window.screenLeft + 8,
      y: window.screenTop + window.outerHeight-8,
    }
    //如果最大则去掉修正
    if (window.screen.width == window.outerWidth) {
      pos = {
        x: 0,
        y: window.screenTop + window.outerHeight,
      }
    }
    console.log(pos, "==========窗口左下角=======")


  </script>
</body>

</html>